#if !defined(DIRECTXWINDOW_H)
#define DIRECTXWINDOW_H

#include "windowswindow.h"
#include <d3d9.h>

/*! \namespace gunsmith Main namespace. */
namespace gunsmith
{
/*!	\class CDirectXWindow
	\brief Initalizes DirectX and provides the screen. */
class CDirectXWindow : public CWindowsWindow
{
public:
							CDirectXWindow();
	virtual					~CDirectXWindow();
	static IDirect3DDevice9 *GetDevice();

protected:
	virtual void CreateScene	();
	virtual void Destroy		();
	virtual void DisplayInfo	(float fDelta);
	virtual void Init			();
	virtual void InitDevice		();
	virtual void PreInit		();
	virtual void Render			(float fDelta);
	virtual void RenderScene	(float fDelta);
	
	static IDirect3DDevice9 *m_pDevice;		//!< static member pointer to the IDirect3DDevice9

private:
	void		CreateDevice		(IDirect3D9 *pD3d);
	void		GetResolutions		(IDirect3D9 *pD3d);
	bool		IsDXInDebugMode		()											const;
	static int	SortAdapterModes	(const void *pModeA, const void *pModeB);

	CDirectXWindow			*m_pInstance;
	D3DDISPLAYMODE			*m_pDisplayModes;
	D3DADAPTER_IDENTIFIER9	m_xAdapIdent;
	D3DCAPS9				m_xCaps;
	IDirect3DQuery9			*m_pQuery;
	bool					m_bDXInDebugMode;
};
};

#endif // DIRECTXWINDOW_H